package shun.vm.instructions;

import shun.vm.VM;

/**
 * Created by chen on 14-5-18.
 */
public abstract class Instruction {

    public static final int add = 0x01;
    public static final int sub = 0x02;
    public static final int mul = 0x03;
    public static final int div = 0x04;
    public static final int mod = 0x05;
    public static final int mov = 0x06;

    protected VM mVm;

    public Instruction(VM vm) {
        mVm = vm;
    }

    protected byte mOpcode;

    public byte getOpcode() {
        return mOpcode;
    }

    public abstract void parse(byte[] codes, int start);

    public abstract void execute();

    public abstract byte length();
}
